define([
    "UtilDir/util",
    "UtilDir/tool",
    "UtilDir/searchBlock",
    "EasyUI","EasyUI-lang"
],function(Util,Tool,SearchBlock){

    //var sysPath =  getServer() + "/static/core/platform";

    //var sysPwdConfigFormHtml = sysPath + "/sys/pwdconfig/views/sysPwdConfigForm.html";
    var getSysPwdConfigController = function(){
        return getServer() + "/fw/app";
    };
    /**
     * 页面初始化
     */
    var init = function(){
        //保存
        $("#saveBtn").click(function(){
            if($('#appConfigForm').valid()){
                var queryString = Tool.serialize("appConfigForm");
                $.ajax({
                    url: getSysPwdConfigController()+"/save",
                    contentType:"application/json",
                    data: JSON.stringify(queryString),
                    type: "post",
                    success: function (data) {
                        Util.alert(data.message);
                        Tool.deserialize("appConfigForm", data);
                    }
                });
            }
        });

       /* jQuery.validator.addMethod("positiveInt", function(value, element) {
            var positiveInt = /^\+?[1-9][0-9]*$/;
            return this.optional(element) || (positiveInt.test(value));
        }, "只可输入正整数")*/;

      /*  //初始化表单验证
        $('#sysPwdConfigForm').validate({
            rules : {
                pwdLength : {
                    digits:true,
                    min:1,
                    max:20
                },
                pwdExpired : {
                    digits:true,
                    min:1,
                    max:365
                },
                tooManyFailures : {
                    digits:true,
                    min:1,
                    max:365,
                    required:true
                },
                lockedTime : {
                    digits:true,
                    min:1,
                    max:24,
                    required:true
                }
            },
            messages : {
                pwdLength : {
                    digits:"请输入正确数字!",
                },
                pwdExpired : {
                    digits:"请输入正确数字!",
                },
                tooManyFailures:{
                    digits:"请输入正确数字!",
                },
                lockedTime:{
                    digits:"请输入正确数字!",
                }
            }
        });*/
    };
    return {
        init:init
    };
});
